@extends('web.master')
@section('title','我的套餐')
@section('head')
    <link rel="stylesheet" href="{{asset('statics/css/index.css')}}"/>
    <style type="text/css">
        .btn_tk{
            color: #fff;
            font-size: 13px;
            display: inline-block;
            width: 50px;
            height: 30px;
            background: #5d93f7;
            box-shadow: 0px 2px 5px 0px rgb(182, 202, 238);
            border-radius: 50px;
            text-align: center;
            line-height: 30px;
            float: right;
            margin: 0px 5px 5px 5px;
        }
        .btn_tk.btn_ytk{
            background: #cfcfcf;
            box-shadow: 0px 2px 5px 0px rgb(230, 230, 230);
        }
        .btn_tk{
            width: auto;
            padding: 0 15px;
        }
        .mask_prize{
            display: none;
        }
        .orderNum{
            font-size: 14px;
            color: #333;
            margin-top: 8px;
        }
        .prize_box{
            background:#fff url(/images/pop.png) no-repeat center center;
            background-size:100% 100%;
            height:auto;
            border-radius:0;
        }
        .pop_box{
            width: 80%;
            margin: 0 auto;
            text-align: left;
            padding: 10% 0;
        }
        .pop_box h2{
            font-size: 17px;
            color: #333;
            font-weight: normal;
        }
        .pop_box img{
            width: 80%;
            margin: 0 auto;
            display: block;
            padding:10% 0;

        }
        .orderNum2{
            text-align: center;
            padding-bottom:10%;
        }
    </style>
@endsection
@section('body-attr','bgBlue')

@section('content')
    <div class="package">
        <!--卡片-->
        @if(count($combos)>0)
            @foreach($combos as $k=>$v)
                <div class="cardBox">
                    <h2>{{$v->body}}</h2>
                    <p class="orderNum">订单号：{{$v->out_trade_no}}</p>
                    <div class="pic">
                        <img src="{{asset('storage/'.$v->thumb)}}">
                    </div>
                    <div class="orange">
                        <b><span>￥</span>{{$v->price}}</b>
                        <b>{{$v->times}}<span>次</span></b>

                        {{--
                      @if($v->is_refund==0)
                      <a href="javascript:void(0)" onclick="refundMoney('{{$v->outTradeNo}}')" class="btn_tk">退款</a>
                          @else
                          <a href="###" class="btn_tk btn_ytk">已退款</a>
                      @endif--}}

                        @if($v->is_send==0)
                        <a href="{{route('ticketQrcode',['out_trade_no'=>$v->out_trade_no])}}" class="btn_tk" >门票二维码</a>
                            @else
                        <a href="###" class="btn_tk btn_ytk">二维码已验证</a>
                        @endif
                    </div>

                    <div class="price">
                        ¥{{$v->combo_price}}   {{$v->times}}次<span>{{$v->created_at}}</span>
                    </div>
                </div>

            @endforeach
        @else
            <div class="null">
                <img src="{{asset('statics/images/null.png')}}"/>
            </div>
    @endif

    <!--end-->
    </div>
@endsection
@section('foot')
    <script src="{{asset('statics/js/layer/layer_mobile/layer.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="/game/js/jquery.min.js"></script>

    <script>
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        var click=0;
        function refundMoney(outTradeNo) {

            if(click==1){
                return '';
            }
            layer.open({
                content: '你确定要退款么?'
                , btn: ['确定', '取消']
                , yes: function (index) {
                    click=1;
                    //请求
                    $.post("{{route('user_combo_Refund')}}", {outTradeNo: outTradeNo}, function (data) {
                        click=0;
                        if (data.code == 0) {
                            layer.open({
                                content: data.msg,
                                btn: '我知道了'
                            });
                        }else if(data.code=='error'){
                            layer.open({
                                content: data.msg,
                                btn: '我知道了'
                            });
                        }
                        else if (data.code == 1) {
                            layer.open({
                                content: data.msg,
                                btn: '我知道了',
                                yes:function () {
                                    location.reload();
                                }
                            });

                        };
                    })
                }
            });
        }


        $(function(){
            $('#pop').click(function(){
                $('.mask_prize').show()
            })
            $('.mask_prize').click(function(){
                $(this).hide()
            })
        })

    </script>
@endsection
